package com.example.assetmanagement.controller;

import com.example.assetmanagement.common.ApiResponse;
import com.example.assetmanagement.service.SystemConfigService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/system/config")
@RequiredArgsConstructor
public class SystemConfigController {

    private final SystemConfigService configService;

    @GetMapping
    public ApiResponse<Map<String, String>> getConfig() {
        return ApiResponse.success(configService.getAll());
    }

    @PutMapping
    public ApiResponse<?> save(@RequestBody Map<String, String> configs) {
        configService.save(configs);
        return ApiResponse.success(null);
    }
} 